package com.haixiaoke.saas.order.service.impl;

import java.util.List;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.order.domain.OrderRefundItem;
import com.haixiaoke.saas.order.mapper.OrderRefundItemMapper;
import com.haixiaoke.saas.order.service.IOrderRefundItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单退费项目及价格Service业务层处理
 *
 * @author panda
 * @date 2024-04-19
 */
@Service
public class OrderRefundItemServiceImpl implements IOrderRefundItemService {
    @Autowired
    private OrderRefundItemMapper orderRefundItemMapper;

    /**
     * 查询订单退费项目及价格
     *
     * @param refundId 订单退费项目及价格主键
     * @return 订单退费项目及价格
     */
    @Override
    public OrderRefundItem selectOrderRefundItemByRefundId(Long refundId) {
        return orderRefundItemMapper.selectOrderRefundItemByRefundId(refundId);
    }

    /**
     * 查询订单退费项目及价格列表
     *
     * @param orderRefundItem 订单退费项目及价格
     * @return 订单退费项目及价格
     */
    @Override
    public List<OrderRefundItem> selectOrderRefundItemList(OrderRefundItem orderRefundItem) {
        return orderRefundItemMapper.selectOrderRefundItemList(orderRefundItem);
    }

    /**
     * 新增订单退费项目及价格
     *
     * @param orderRefundItem 订单退费项目及价格
     * @return 结果
     */
    @Override
    public int insertOrderRefundItem(OrderRefundItem orderRefundItem) {
        orderRefundItem.setCreateTime(DateUtils.getNowDate());
        return orderRefundItemMapper.insertOrderRefundItem(orderRefundItem);
    }

    /**
     * 修改订单退费项目及价格
     *
     * @param orderRefundItem 订单退费项目及价格
     * @return 结果
     */
    @Override
    public int updateOrderRefundItem(OrderRefundItem orderRefundItem) {
        orderRefundItem.setUpdateTime(DateUtils.getNowDate());
        return orderRefundItemMapper.updateOrderRefundItem(orderRefundItem);
    }

    /**
     * 批量删除订单退费项目及价格
     *
     * @param refundIds 需要删除的订单退费项目及价格主键
     * @return 结果
     */
    @Override
    public int deleteOrderRefundItemByRefundIds(Long[] refundIds) {
        return orderRefundItemMapper.deleteOrderRefundItemByRefundIds(refundIds);
    }

    /**
     * 删除订单退费项目及价格信息
     *
     * @param refundId 订单退费项目及价格主键
     * @return 结果
     */
    @Override
    public int deleteOrderRefundItemByRefundId(Long refundId) {
        return orderRefundItemMapper.deleteOrderRefundItemByRefundId(refundId);
    }

    @Override
    public int insertBatchOrderRefundItem(List<OrderRefundItem> orderRefundItemList) {
        return orderRefundItemMapper.insertBatchOrderRefundItem(orderRefundItemList);
    }

    @Override
    public List<OrderRefundItem> selectOrderRefundItemByOrderId(String orderId) {
        return orderRefundItemMapper.selectOrderRefundItemByOrderId(orderId);
    }

    @Override
    public int updateBatchOrderRefundItem(List<OrderRefundItem> refundItemList) {
        return orderRefundItemMapper.updateBatchOrderRefundItem(refundItemList);
    }

    @Override
    public OrderRefundItem selectOrderRefundItemByOrderIdAndRefundType(String orderId, String refundType) {
        return orderRefundItemMapper.selectOrderRefundItemByOrderIdAndRefundType(orderId,refundType);
    }

    @Override
    public OrderRefundItem selectOrderRefundItemByOrderIdAndRefundTypeAndRecordId(String orderId, String refundType, Long recordId) {
        return orderRefundItemMapper.selectOrderRefundItemByOrderIdAndRefundTypeAndRecordId(orderId,refundType,recordId);
    }

    @Override
    public List<OrderRefundItem> selectOrderRefundItemByOrderIdOrLinkedOrderId(String orderId) {
        return orderRefundItemMapper.selectOrderRefundItemByOrderIdOrLinkedOrderId(orderId);
    }

    @Override
    public List<OrderRefundItem> selectOrderRefundItemByOrderIdAndRecordId(String orderId, Long recordId) {
        return orderRefundItemMapper.selectOrderRefundItemByOrderIdAndRecordId(orderId,recordId);
    }

    @Override
    public int deleteOrderRefundItemByOrderId(String orderId) {
        return orderRefundItemMapper.deleteOrderRefundItemByOrderId(orderId);
    }
}
